home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Online / Apache / include / apache / ap_config.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-06-06  |  37.0 KB  |  1,462 lines

  1. /* ====================================================================
  2.  * The Apache Software License, Version 1.1
  3.  *
  4.  * Copyright (c) 2000 The Apache Software Foundation.  All rights
  5.  * reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  *
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in
  16.  *    the documentation and/or other materials provided with the
  17.  *    distribution.
  18.  *
  19.  * 3. The end-user documentation included with the redistribution,
  20.  *    if any, must include the following acknowledgment:
  21.  *       "This product includes software developed by the
  22.  *        Apache Software Foundation (http://www.apache.org/)."
  23.  *    Alternately, this acknowledgment may appear in the software itself,
  24.  *    if and wherever such third-party acknowledgments normally appear.
  25.  *
  26.  * 4. The names "Apache" and "Apache Software Foundation" must
  27.  *    not be used to endorse or promote products derived from this
  28.  *    software without prior written permission. For written
  29.  *    permission, please contact apache@apache.org.
  30.  *
  31.  * 5. Products derived from this software may not be called "Apache",
  32.  *    nor may "Apache" appear in their name, without prior written
  33.  *    permission of the Apache Software Foundation.
  34.  *
  35.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  36.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  37.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38.  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  39.  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  41.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  42.  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  43.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44.  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  45.  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46.  * SUCH DAMAGE.
  47.  * ====================================================================
  48.  *
  49.  * This software consists of voluntary contributions made by many
  50.  * individuals on behalf of the Apache Software Foundation.  For more
  51.  * information on the Apache Software Foundation, please see
  52.  * <http://www.apache.org/>.
  53.  *
  54.  * Portions of this software are based upon public domain software
  55.  * originally written at the National Center for Supercomputing Applications,
  56.  * University of Illinois, Urbana-Champaign.
  57.  */
  58.  
  59. #ifndef AP_CONFIG_H
  60. #define AP_CONFIG_H
  61.  
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65.  
  66. /*
  67.  * ap_config.h: system-dependant #defines and includes...
  68.  * See PORTING for a listing of what they mean
  69.  */
  70.  
  71. #include "ap_mmn.h"        /* MODULE_MAGIC_NUMBER_ */
  72.  
  73. /*
  74.  * Support for platform dependent autogenerated defines
  75.  */
  76. #if !defined(WIN32) && !defined(NETWARE)
  77. #include "ap_config_auto.h"
  78. #else
  79. /* not available under WIN32, so provide important entries manually */
  80. #undef HAVE_UNISTD_H
  81. #endif
  82.  
  83. /* Have to include sys/stat.h before ../win32/os.h so we can override
  84. stat() properly */
  85. #ifndef NETWARE
  86. #include <sys/types.h>
  87. #endif
  88. #include <sys/stat.h>
  89.  
  90.  
  91. /* So that we can use inline on some critical functions, and use
  92.  * GNUC attributes (such as to get -Wall warnings for printf-like
  93.  * functions).  Only do this in gcc 2.7 or later ... it may work
  94.  * on earlier stuff, but why chance it.
  95.  *
  96.  * We've since discovered that the gcc shipped with NeXT systems
  97.  * as "cc" is completely broken.  It claims to be __GNUC__ and so
  98.  * on, but it doesn't implement half of the things that __GNUC__
  99.  * means.  In particular it's missing inline and the __attribute__
  100.  * stuff.  So we hack around it.  PR#1613. -djg
  101.  */
  102. #if !defined(__GNUC__) || __GNUC__ < 2 || \
  103.     (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\
  104.     defined(NEXT)
  105. #define ap_inline
  106. #define __attribute__(__x)
  107. #define ENUM_BITFIELD(e,n,w)  signed int n : w
  108. #else
  109. #define ap_inline __inline__
  110. #define USE_GNU_INLINE
  111. #define ENUM_BITFIELD(e,n,w)  e n : w
  112. #endif
  113.  
  114. #include "os.h"
  115.  
  116. /* Define one of these according to your system. */
  117. #if defined(MINT)
  118. typedef int rlim_t;
  119. #define JMP_BUF sigjmp_buf
  120. #define NO_LONG_DOUBLE
  121. #define USE_FLOCK_SERIALIZED_ACCEPT
  122. #define _BSD_SOURCE
  123. #define EAGAIN EWOULDBLOCK
  124. int initgroups (char *, int);     
  125. char *crypt (const char *pw, const char *salt);
  126. int gethostname (char *name, int namelen);
  127.  
  128. #elif defined(MPE)
  129. #include <sys/times.h>
  130. #define NO_SETSID
  131. #define NO_KILLPG
  132. #define NO_WRITEV
  133. #define HAVE_SHMGET 1
  134. #define USE_SHMGET_SCOREBOARD
  135. /* 
  136.    UID/GID isn't a native concept for MPE, and it's definitely not a 100%
  137.    Unix implementation.  There isn't a traditional superuser concept either,
  138.    so we're forced to liberalize SHM security a bit so the parent & children
  139.    can communicate when they're running with different UIDs within the same
  140.    GID (the GID will *always* be the same on MPE).  Thus the weird SHM_R and
  141.    SHM_W below.
  142. */
  143. #define SHM_R 0440  /* Read permission */
  144. #define SHM_W 0220  /* Write permission */
  145. #define NEED_INITGROUPS
  146. #define NEED_STRCASECMP
  147. #define NEED_STRDUP
  148. #define NEED_STRNCASECMP
  149. extern void GETPRIVMODE();
  150. extern void GETUSERMODE();
  151. extern char *inet_ntoa();
  152. #define NO_SLACK
  153. #define S_IEXEC  S_IXUSR
  154. #define S_IREAD  S_IRUSR
  155. #define S_IWRITE S_IWUSR
  156. #define PF_INET  AF_INET
  157. #define USE_FCNTL_SERIALIZED_ACCEPT
  158.  
  159. #elif defined(SUNOS4)
  160. #define HAVE_GMTOFF 1
  161. #undef NO_KILLPG
  162. #undef NO_SETSID
  163. char *crypt(const char *pw, const char *salt);
  164. char *mktemp(char *);
  165. #define HAVE_MMAP 1
  166. #define USE_MMAP_SCOREBOARD
  167. #define USE_MMAP_FILES
  168. #include <sys/time.h>
  169. #define NEED_STRERROR
  170. typedef int rlim_t;
  171. #define memmove(a,b,c) bcopy(b,a,c)
  172. #define NO_LINGCLOSE
  173. #define USE_FLOCK_SERIALIZED_ACCEPT
  174. #define NEED_DIFFTIME
  175. #define HAVE_SYSLOG 1
  176.  
  177. #elif defined(SOLARIS2)
  178. #undef HAVE_GMTOFF
  179. #define NO_KILLPG
  180. #undef NO_SETSID
  181. #define bzero(a,b) memset(a,0,b)
  182. #if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \
  183.     !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
  184. #define USE_FCNTL_SERIALIZED_ACCEPT
  185. #endif
  186. #define NEED_UNION_SEMUN
  187. #define HAVE_MMAP 1
  188. #define USE_MMAP_SCOREBOARD
  189. #define USE_MMAP_FILES
  190. int gethostname(char *name, int namelen);
  191. #define HAVE_SYSLOG 1
  192. #define SYS_SIGLIST _sys_siglist
  193.  
  194. #elif defined(IRIX)
  195. #undef HAVE_GMTOFF
  196. /* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
  197.  * there's some weird conflict with non-BSD signals */
  198. #define NO_KILLPG
  199. #undef NO_SETSID
  200. #if !defined(USE_FLOCK_SERIALIZED_ACCEPT) && \
  201.     !defined(USE_USLOCK_SERIALIZED_ACCEPT) && \
  202.     !defined(USE_SYSVSEM_SERIALIZED_ACCEPT)
  203. #define USE_FCNTL_SERIALIZED_ACCEPT
  204. #endif
  205. #define HAVE_SHMGET 1
  206. #define USE_SHMGET_SCOREBOARD
  207. #define HAVE_MMAP 1
  208. #define USE_MMAP_FILES
  209. #define NO_LONG_DOUBLE
  210. #define NO_LINGCLOSE
  211. #define HAVE_SYSLOG 1
  212.  
  213. #elif defined(HIUX)
  214. #undef HAVE_GMTOFF
  215. #define NO_KILLPG
  216. #undef NO_SETSID
  217. #ifndef _HIUX_SOURCE
  218. #define _HIUX_SOURCE
  219. #endif
  220. #define HAVE_SHMGET 1
  221. #define USE_SHMGET_SCOREBOARD
  222. #define SELECT_NEEDS_CAST
  223. #define HAVE_SYSLOG 1
  224.  
  225. #elif defined(HPUX) || defined(HPUX10)
  226. #undef HAVE_GMTOFF
  227. #define NO_KILLPG
  228. #undef NO_SETSID
  229. #define USE_FCNTL_SERIALIZED_ACCEPT
  230. #ifndef _HPUX_SOURCE
  231. #define _HPUX_SOURCE
  232. #endif
  233. #define HAVE_SHMGET 1
  234. #define USE_SHMGET_SCOREBOARD
  235. #define HAVE_SYSLOG 1
  236. #ifndef HPUX10
  237. #define SELECT_NEEDS_CAST
  238. typedef int rlim_t;
  239. #endif
  240.  
  241. #elif defined(HPUX11)
  242. #ifndef _HPUX_SOURCE
  243. #define _HPUX_SOURCE
  244. #endif
  245. #define HAVE_SHMGET
  246. #define USE_SHMGET_SCOREBOARD
  247. #undef  HAVE_GMTOFF
  248. #define USE_FCNTL_SERIALIZED_ACCEPT
  249. /* feeling brave?  want to try using POSIX mutexes? */
  250. /* #define HAVE_MMAP */
  251. /* #define USE_MMAP_SCOREBOARD */
  252. /* #define USE_MMAP_FILES */
  253. /* #define USE_PTHREAD_SERIALIZED_ACCEPT */
  254. #define NO_KILLPG
  255. #undef  NO_SETSID
  256. #define HAVE_SYSLOG
  257.  
  258. #elif defined(AIX)
  259. #undef HAVE_GMTOFF
  260. #undef NO_KILLPG
  261. #undef NO_SETSID
  262. #ifndef __ps2__
  263. #define HAVE_MMAP 1
  264. #define USE_MMAP_SCOREBOARD
  265. #define USE_MMAP_FILES
  266. #define HAVE_SYSLOG 1
  267. #ifndef DEFAULT_GROUP
  268. #define DEFAULT_GROUP "nobody"
  269. #endif
  270. #endif
  271. #ifndef DEFAULT_USER
  272. #define DEFAULT_USER "nobody"
  273. #endif
  274. #ifdef NEED_RLIM_T
  275. typedef int rlim_t;
  276. #endif
  277. #if !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
  278. #define USE_FCNTL_SERIALIZED_ACCEPT
  279. #endif
  280. #ifdef USEBCOPY
  281. #define memmove(a,b,c) bcopy(b,a,c)
  282. #endif
  283. #if AIX >= 42
  284. #define NET_SIZE_T size_t
  285. #endif
  286.  
  287. #elif defined(AMIGA)
  288. #define _INLINE_EXEC_H
  289. #define Debug AmigaDebug
  290. #include <proto/exec.h>
  291. #undef Debug
  292. #undef _INLINE_EXEC_H
  293. #include <inline/exec.h>
  294. #undef Debug
  295. #include <dos/var.h>
  296. #include <proto/dos.h>
  297. #include <dos/dosextens.h>
  298. #include <exec/ports.h>
  299. #include <proto/dos.h>
  300. #define HAVE_SHMGET
  301. #define USE_SHMGET_SCOREBOARD
  302. #define HAVE_GMTOFF
  303. #define USE_SYSVSEM_SERIALIZED_ACCEPT
  304. #define NO_KILLPG
  305. #define NO_SETSID
  306. #define JMP_BUF sigjmp_buf
  307. #undef NO_LINGCLOSE
  308. #define NO_SLACK
  309. #define HAVE_SYSLOG
  310. #define SHM_R IPC_R
  311. #define SHM_W IPC_W
  312. #define SHM_M IPC_M
  313. #define CHILD_ENV_VARIABLE "CHILD_NUMBER"
  314. #define ACCEPT_CHILD_NUMBER 0 /* child number which does the accepting > 0 does a getmsg */
  315. #define ix_wait(pmask) ix_select(0, NULL, NULL, NULL, NULL, pmask)
  316. #include <sys/socket.h>
  317. struct ChildMsg {
  318.     struct Message msg;
  319.     long id;
  320.     int inet;
  321.     int stream;
  322.     int protocol;
  323.     time_t restart_time; /* useful in server status */
  324.     struct sockaddr sa_client;
  325. };
  326. #elif defined(ULTRIX)
  327. /* we don't want to use sys/resource.h under
  328.    Ultrix although this header exists. */
  329. #undef HAVE_SYS_RESOURCE_H
  330. #define HAVE_GMTOFF 1
  331. #undef NO_KILLPG
  332. #undef NO_SETSID
  333. #define ULTRIX_BRAIN_DEATH
  334. #define NEED_STRDUP
  335. /* If you have Ultrix 4.3, and are using cc, const is broken */
  336. #ifndef __ultrix__        /* Hack to check for pre-Ultrix 4.4 cc */
  337. #define const            /* Not implemented */
  338. #endif
  339.  
  340. #elif defined(OSF1)
  341. #define HAVE_GMTOFF 1
  342. #undef NO_KILLPG
  343. #undef NO_SETSID
  344. #define HAVE_MMAP 1
  345. #define USE_MMAP_SCOREBOARD
  346. #define USE_MMAP_FILES
  347. #define NO_LONG_DOUBLE
  348. #define HAVE_SYSLOG 1
  349. #define USE_FLOCK_SERIALIZED_ACCEPT
  350. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  351.  
  352. #elif defined(PARAGON)
  353. #define HAVE_GMTOFF 1
  354. #undef NO_KILLPG
  355. #undef NO_SETSID
  356. #define HAVE_MMAP 1
  357. #define USE_MMAP_SCOREBOARD
  358. #define USE_MMAP_FILES
  359. #define NO_LONG_DOUBLE
  360. #define HAVE_SYSLOG 1
  361. typedef int rlim_t;
  362.  
  363. #elif defined(SEQUENT)
  364. #define DEFAULT_USER "nobody"
  365. #define DEFAULT_GROUP "nobody"
  366. #define NO_SHMGET 1
  367. #define HAVE_MMAP 1
  368. #define HAVE_SYSLOG 1
  369. #define USE_MMAP_FILES 1
  370. #define USE_MMAP_SCOREBOARD 1
  371. #define USE_FCNTL_SERIALIZED_ACCEPT 1
  372. #define JMP_BUF sigjmp_buf
  373. #undef NO_SETSID
  374. #if SEQUENT < 40
  375. typedef int rlim_t;
  376. #define NO_GETTIMEOFDAY
  377. #undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
  378. #include <sys/times.h>
  379. #endif
  380. #if SEQUENT < 42
  381. #define NEED_STRCASECMP
  382. #define NEED_STRNCASECMP
  383. #endif
  384. #if SEQUENT < 44
  385. #define NO_KILLPG 1
  386. #define NET_SIZE_T int
  387. #endif
  388. #if SEQUENT >= 44
  389. #undef NO_KILLPG
  390. #define NET_SIZE_T size_t
  391. #endif
  392.  
  393. #elif defined(NEXT)
  394. typedef unsigned short mode_t;
  395. typedef int rlim_t;
  396. #define HAVE_GMTOFF 1
  397. #undef NO_KILLPG
  398. #define NO_SETSID
  399. #define NEED_STRDUP
  400. #define NO_LINGCLOSE
  401. #undef _POSIX_SOURCE
  402. #ifndef FD_CLOEXEC
  403. #define FD_CLOEXEC 1
  404. #endif
  405. #ifndef S_ISDIR
  406. #define S_ISDIR(m)      (((m)&(S_IFMT)) == (S_IFDIR))
  407. #endif
  408. #ifndef S_ISREG
  409. #define S_ISREG(m)      (((m)&(S_IFMT)) == (S_IFREG))
  410. #endif
  411. #ifndef S_IXUSR
  412. #define S_IXUSR 00100
  413. #endif
  414. #ifndef S_IRGRP
  415. #define S_IRGRP 00040
  416. #endif
  417. #ifndef S_IXGRP
  418. #define S_IXGRP 00010
  419. #endif
  420. #ifndef S_IROTH
  421. #define S_IROTH 00004
  422. #endif
  423. #ifndef S_IXOTH
  424. #define S_IXOTH 00001
  425. #endif
  426. #ifndef S_IRUSR
  427. #define S_IRUSR S_IREAD
  428. #endif
  429. #ifndef S_IWUSR
  430. #define S_IWUSR S_IWRITE
  431. #endif
  432. #ifndef S_IWGRP
  433. #define S_IWGRP    000020
  434. #endif
  435. #ifndef S_IWOTH
  436. #define S_IWOTH 000002
  437. #endif
  438.  
  439. #define STDIN_FILENO  0
  440. #define STDOUT_FILENO 1
  441. #define STDERR_FILENO 2
  442.  
  443. /* PR#2293 fix */
  444. #define    ap_wait_t    union wait
  445. #define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
  446. #define WEXITSTATUS(status)     (int)( WIFEXITED(status) ? ( (status).w_retcode ) : -1)
  447. #define WTERMSIG(status)    (int)( (status).w_termsig )
  448.  
  449. typedef int pid_t;
  450. #define USE_LONGJMP
  451. #define NO_USE_SIGACTION
  452. #define HAVE_SYSLOG 1
  453.  
  454. #if defined(__DYNAMIC__)
  455. #define HAVE_DYLD
  456. #define DYLD_CANT_UNLOAD
  457. #endif
  458.  
  459. #elif defined(DARWIN) /* Darwin (Mac OS) */
  460. #undef PLATFORM
  461. #define PLATFORM "Darwin"
  462. #define HAVE_DYLD
  463. #define HAVE_GMTOFF
  464. #define HAVE_MMAP
  465. #define USE_MMAP_FILES
  466. #define USE_MMAP_SCOREBOARD
  467. #ifdef MAC_OS_X_SERVER
  468. #define MAP_TMPFILE
  469. #endif /* MAC_OS_X_SERVER */
  470. #define HAVE_RESOURCE
  471. #define HAVE_SNPRINTF
  472. #define JMP_BUF jmp_buf
  473. #define USE_LONGJMP
  474. #define USE_FLOCK_SERIALIZED_ACCEPT
  475. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  476.  
  477. #elif defined(LINUX)
  478.  
  479. #if LINUX > 1
  480. #include <features.h>
  481.  
  482. /* libc4 systems probably still work, it probably doesn't define
  483.  *  __GNU_LIBRARY__
  484.  * libc5 systems define __GNU_LIBRARY__ == 1, but don't define __GLIBC__
  485.  * glibc 2.x and later systems define __GNU_LIBRARY__ == 6, but list it as
  486.  * "deprecated in favour of __GLIBC__"; the value 6 will never be changed.
  487.  * glibc 1.x systems (i.e. redhat 4.x on sparc/alpha) should have
  488.  * __GLIBC__ < 2
  489.  * all glibc based systems need crypt.h
  490.  */
  491. #if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
  492. #include <crypt.h>
  493. #endif
  494.  
  495. /* glibc 2.0.0 through 2.0.4 need size_t * here, where 2.0.5 needs socklen_t *
  496.  * there's no way to discern between these two libraries.  But using int should
  497.  * be portable because otherwise these libs would be hopelessly broken with
  498.  * reams of existing networking code.  We'll use socklen_t * for 2.1.x and
  499.  * later.
  500.  *
  501.  * int works for all the earlier libs, and is picked up by default later.
  502.  */
  503. #if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0))
  504. #define NET_SIZE_T socklen_t
  505. #endif
  506.  
  507. #define HAVE_SHMGET 1
  508. #define USE_SHMGET_SCOREBOARD
  509. #define HAVE_MMAP 1
  510. #define USE_MMAP_FILES
  511.  
  512. #if LINUX > 20
  513. /* see Pine.LNX.4.21.0011041233550.1897-100000@twinlark.arctic.org
  514.  * in new-httpd archives for performance numbers indicating these
  515.  * are the right choices for linux 2.2.x and later
  516.  */
  517. #define USE_SYSVSEM_SERIALIZED_ACCEPT
  518. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT 
  519. #include <sys/sem.h>
  520. #if _SEM_SEMUN_UNDEFINED
  521. #define NEED_UNION_SEMUN
  522. #endif
  523. #else
  524. #define USE_FCNTL_SERIALIZED_ACCEPT
  525. #endif
  526.  
  527. #define SYS_SIGLIST    _sys_siglist
  528.  
  529. #else
  530. #define USE_FCNTL_SERIALIZED_ACCEPT
  531. #endif
  532.  
  533. #undef HAVE_GMTOFF
  534. #undef NO_KILLPG
  535. #undef NO_SETSID
  536. #undef NEED_STRDUP
  537. #include <sys/time.h>
  538. #define HAVE_SYSLOG 1
  539.  
  540. /* glibc 2.1 and later finally define rlim_t */
  541. #if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
  542. typedef int rlim_t;
  543. #endif
  544.  
  545. #elif defined(SCO)
  546. #undef HAVE_GMTOFF
  547. #undef NO_KILLPG
  548. #undef NO_SETSID
  549. #define NEED_INITGROUPS
  550. #define NO_WRITEV
  551. #include <sys/time.h>
  552. #define HAVE_SYSLOG 1
  553. #undef HAVE_SYS_RESOURCE_H
  554.  
  555. #elif defined(SCO5)
  556.  
  557. #define USE_FCNTL_SERIALIZED_ACCEPT
  558. #define HAVE_MMAP 1
  559. #define USE_MMAP_SCOREBOARD
  560. #define USE_MMAP_FILES
  561. #define SecureWare
  562. #define HAVE_SYSLOG 1
  563.  
  564. /* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
  565.    consts. Sigh. */
  566. extern int strcasecmp(const char *, const char *);
  567. extern int strncasecmp(const char *, const char *, unsigned);
  568.  
  569. #elif defined(AUX3)
  570. /* These are to let -Wall compile more cleanly */
  571. extern int strcasecmp(const char *, const char *);
  572. extern int strncasecmp(const char *, const char *, unsigned);
  573. extern int set42sig(), getopt(), getpeername(), bzero();
  574. extern int listen(), bind(), socket(), getsockname();
  575. extern int accept(), gethostname(), connect(), lstat();
  576. extern int select(), killpg(), shutdown();
  577. extern int initgroups(), setsockopt();
  578. extern char *shmat();
  579. extern int shmctl();
  580. extern int shmget();
  581. extern char *sbrk();
  582. extern char *crypt();
  583. #include <sys/time.h>
  584. #undef HAVE_GMTOFF
  585. #undef NO_KILLPG
  586. #undef NO_SETSID
  587. #define NEED_STRDUP
  588. /* fcntl() locking is expensive with NFS */
  589. #define USE_FLOCK_SERIALIZED_ACCEPT
  590. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  591. #define HAVE_SHMGET 1
  592. #define USE_SHMGET_SCOREBOARD
  593. /*
  594.  * NOTE: If when you run Apache under A/UX and you get a warning
  595.  * that httpd couldn't move break, then the below value for
  596.  * MOVEBREAK (64megs) is too large for your setup. Try reducing
  597.  * to 0x2000000 which is still PLENTY of space. I doubt if
  598.  * even on heavy systems sbrk() would be called at all...
  599.  */
  600. #define MOVEBREAK        0x4000000
  601. #define NO_LINGCLOSE
  602. #define NO_SLACK
  603. #define HAVE_SYSLOG 1
  604. #undef HAVE_SYS_RESOURCE_H    /* exists but does not provide *rlimit funcs */
  605.  
  606. #elif defined(SVR4)
  607. #define NO_KILLPG
  608. #undef  NO_SETSID
  609. #undef NEED_STRDUP
  610. #ifndef MPRAS
  611. #define NEED_STRCASECMP
  612. #ifndef ENCORE
  613. #define NEED_STRNCASECMP
  614. #endif /* ENCORE */
  615. #endif /* MPRAS */
  616. #define bzero(a,b) memset(a,0,b)
  617. /* A lot of SVR4 systems need this */
  618. #ifndef USE_SYSVSEM_SERIALIZED_ACCEPT
  619. #define USE_FCNTL_SERIALIZED_ACCEPT
  620. #endif
  621. #define HAVE_SYSLOG 1
  622. #define NET_SIZE_T size_t
  623. #define HAVE_SHMGET 1
  624. #define USE_SHMGET_SCOREBOARD
  625. #ifdef _OSD_POSIX /* BS2000-POSIX mainframe needs initgroups */
  626. #define NEED_HASHBANG_EMUL /* execve() doesn't start shell scripts by default */
  627. #define _KMEMUSER          /* Enable SHM_R/SHM_W defines in <shm.h> */
  628. #undef NEED_STRCASECMP
  629. #undef NEED_STRNCASECMP
  630. #undef bzero
  631. #endif /*_OSD_POSIX*/
  632.  
  633. #elif defined(UW)
  634. #if UW < 700
  635. #define USE_FCNTL_SERIALIZED_ACCEPT
  636. #define NO_LINGCLOSE
  637. #define NO_KILLPG
  638. #endif
  639. #undef  NO_SETSID
  640. #undef NEED_STRDUP
  641. #define NEED_STRCASECMP
  642. #define NEED_STRNCASECMP
  643. #define bzero(a,b) memset(a,0,b)
  644. #define HAVE_MMAP 1
  645. #define USE_MMAP_SCOREBOARD
  646. #define USE_MMAP_FILES
  647. #define HAVE_SHMGET 1
  648. #undef USE_SHMGET_SCOREBOARD    /* force use of mmap() scoreboard */
  649. #include <sys/time.h>
  650. #if UW >= 200
  651. #define _POSIX_SOURCE
  652. #endif
  653. #define NET_SIZE_T size_t
  654. #define HAVE_SYSLOG 1
  655.  
  656. #elif defined(DGUX)
  657. #define NO_KILLPG
  658. #undef  NO_SETSID
  659. #undef NEED_STRDUP
  660. #ifdef _IX86_DG
  661. #undef NEED_STRCASECMP
  662. #undef NEED_STRNCASECMP
  663. #else
  664. #define NEED_STRCASECMP
  665. #define NEED_STRNCASECMP
  666. #endif
  667. #define bzero(a,b) memset(a,0,b)
  668. /* A lot of SVR4 systems need this */
  669. #define USE_FCNTL_SERIALIZED_ACCEPT
  670. #define ap_inet_addr inet_network
  671. #define HAVE_SYSLOG 1
  672.  
  673. #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(NETBSD)
  674. #define HAVE_GMTOFF 1
  675. #undef NO_KILLPG
  676. #undef NO_SETSID
  677. #define HAVE_SYSLOG 1
  678. #ifndef DEFAULT_USER
  679. #define DEFAULT_USER "nobody"
  680. #endif
  681. #ifndef DEFAULT_GROUP
  682. #define DEFAULT_GROUP "nogroup"
  683. #endif
  684. #define HAVE_SHMGET 1
  685. #define HAVE_MMAP 1
  686. #define USE_MMAP_SCOREBOARD
  687. #define USE_MMAP_FILES
  688. #define USE_FLOCK_SERIALIZED_ACCEPT
  689. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  690.  
  691. #elif defined(UTS21)
  692. #undef HAVE_GMTOFF
  693. #undef NO_KILLPG
  694. #define NO_SETSID
  695. #define NEED_WAITPID
  696. #define STDIN_FILENO 0
  697. #define STDOUT_FILENO 1
  698. #define STDERR_FILENO 2
  699. #define HAVE_SYSLOG 1
  700. #define USE_LONGJMP
  701. #define JMP_BUF jmp_buf
  702. #define NO_USE_SIGACTION
  703. #define NEED_STRERROR
  704. #define NEED_STRSTR
  705. #define NEED_HASHBANG_EMUL
  706. #define NDELAY_PIPE_RETURNS_ZERO
  707. #define NO_DATA NO_ADDRESS
  708. #define    ap_wait_t        union wait
  709. #define WEXITSTATUS(status)    (int)((status).w_retcode)
  710. #define WTERMSIG(status)    (int)((status).w_termsig)
  711. #define strftime(buf,bufsize,fmt,tm)    ascftime(buf,fmt,tm)
  712. #undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
  713. #include <sys/types.h>
  714. #include <sys/time.h>     
  715.  
  716. #elif defined(APOLLO)
  717. #undef HAVE_GMTOFF
  718. #undef NO_KILLPG
  719. #undef NO_SETSID
  720. #define HAVE_SYSLOG 1
  721.  
  722. #elif defined(__FreeBSD__) || defined(__bsdi__)
  723. #if defined(__FreeBSD__)
  724. #include <osreldate.h>
  725. #endif
  726. #define HAVE_GMTOFF 1
  727. #undef NO_KILLPG
  728. #undef NO_SETSID
  729. #define HAVE_MMAP 1
  730. #define USE_MMAP_SCOREBOARD
  731. #define USE_MMAP_FILES
  732. #ifndef DEFAULT_USER
  733. #define DEFAULT_USER "nobody"
  734. #endif
  735. #ifndef DEFAULT_GROUP
  736. #define DEFAULT_GROUP "nogroup"
  737. #endif
  738. #if defined(__bsdi__) || \
  739. (defined(__FreeBSD_version) && (__FreeBSD_version < 220000))
  740. typedef quad_t rlim_t;
  741. #endif
  742. #define USE_FLOCK_SERIALIZED_ACCEPT
  743. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  744. #define HAVE_SYSLOG 1
  745. #define SYS_SIGLIST sys_siglist
  746. #if (defined(__FreeBSD_version) && (__FreeBSD_version >= 400000))
  747. #define NET_SIZE_T socklen_t
  748. #endif
  749.  
  750. #elif defined(QNX)
  751. #ifndef crypt
  752. char *crypt(const char *pw, const char *salt);
  753. #endif
  754. #ifndef initgroups
  755. int initgroups(char *, int);
  756. #endif
  757. #ifndef strncasecmp
  758. #define strncasecmp strnicmp
  759. #endif
  760. #undef NO_KILLPG
  761. #undef NO_SETSID
  762. #define NEED_INITGROUPS
  763. #define NEED_SELECT_H
  764. #define NEED_PROCESS_H
  765. #include <unix.h>
  766. #define HAVE_MMAP 1
  767. #define USE_POSIX_SCOREBOARD
  768. #define USE_FLOCK_SERIALIZED_ACCEPT
  769. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  770. #define HAVE_SYSLOG 1
  771.  
  772. #elif defined(LYNXOS)
  773. #undef HAVE_GMTOFF
  774. #undef USE_MMAP_SCOREBOARD
  775. #undef USE_SHMGET_SCOREBOARD
  776. #undef USE_FCNTL_SERIALIZED_ACCEPT
  777. #undef USE_FLOCK_SERIALIZED_ACCEPT
  778. #define USE_LONGJMP
  779. #undef NO_KILLPG
  780. #undef NO_SETSID
  781. #undef NO_USE_SIGACTION
  782. #undef NO_LINGCLOSE
  783. extern char *crypt(char *pw, char *salt);
  784. typedef int rlim_t;
  785. #define HAVE_SYSLOG 1
  786.  
  787. #elif defined(UXPDS)
  788. #undef NEED_STRCASECMP
  789. #undef NEED_STRNCASECMP
  790. #undef NEED_STRDUP
  791. #undef HAVE_GMTOFF
  792. #define NO_KILLPG
  793. #undef NO_SETSID
  794. #define bzero(a,b) memset(a,0,b)
  795. #define USE_FCNTL_SERIALIZED_ACCEPT
  796. #define HAVE_MMAP 1
  797. #define USE_MMAP_SCOREBOARD
  798. #define USE_MMAP_FILES
  799. #define HAVE_SYSLOG 1
  800.  
  801. #elif defined(OS2)
  802. /* Defines required for EMX OS/2 port. */
  803. #define NO_KILLPG
  804. #define NEED_STRCASECMP
  805. #define NEED_STRNCASECMP
  806. #define NEED_PROCESS_H
  807. #define NO_SETSID
  808. #define NO_TIMES
  809. #define CASE_BLIND_FILESYSTEM
  810. /* Add some drive name support */
  811. #define chdir _chdir2
  812. #include <sys/time.h>
  813. #define MAXSOCKETS 2048
  814. #define USE_OS2_SCOREBOARD
  815. #define NO_RELIABLE_PIPED_LOGS
  816. #define USE_OS2SEM_SERIALIZED_ACCEPT
  817. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  818. #define NO_SLACK
  819. #define FOPEN_REQUIRES_T
  820.  
  821. #elif defined(__MACHTEN__)
  822. typedef int rlim_t;
  823. #undef NO_KILLPG
  824. #define NO_SETSID
  825. #define HAVE_GMTOFF 1
  826. #ifndef __MACHTEN_PPC__
  827. #ifndef __MACHTEN_68K__
  828. #define __MACHTEN_68K__
  829. #endif
  830. #define USE_FLOCK_SERIALIZED_ACCEPT
  831. #define NO_USE_SIGACTION
  832. #define JMP_BUF sigjmp_buf
  833. #define USE_LONGJMP
  834. #undef NEED_STRDUP
  835. #else
  836. #define HAVE_SHMGET 1
  837. #define USE_SHMGET_SCOREBOARD
  838. #define USE_FCNTL_SERIALIZED_ACCEPT
  839. #endif
  840.  
  841. /* Convex OS v11 */
  842. #elif defined(CONVEXOS11)
  843. #undef HAVE_GMTOFF
  844. #undef NO_KILLPG
  845. #undef NO_SETSID
  846. #undef NEED_STRDUP
  847. #define HAVE_MMAP 1
  848. #define USE_MMAP_SCOREBOARD
  849. #define USE_MMAP_FILES
  850. #define HAVE_SYSLOG 1
  851.  
  852. #define NO_TIMEZONE
  853. #include <stdio.h>
  854. #include <sys/types.h>
  855. typedef int rlim_t;
  856.  
  857. #elif defined(ISC)
  858. #include <net/errno.h>
  859. #define NO_KILLPG
  860. #undef NO_SETSID
  861. #define HAVE_SHMGET 1
  862. #define USE_SHMGET_SCOREBOARD
  863. #define USE_FCNTL_SERIALIZED_ACCEPT
  864. #define HAVE_SYSLOG 1
  865.  
  866. #elif defined(NEWSOS)
  867. #define HAVE_SHMGET 1
  868. #define USE_SHMGET_SCOREBOARD
  869. #define USE_LONGJMP
  870. #define NO_SETSID
  871. #define NO_USE_SIGACTION
  872. #define NEED_WAITPID
  873. #define NO_OTHER_CHILD
  874. #define HAVE_SYSLOG 1
  875. #include <sys/time.h>
  876. #include <stdlib.h>
  877. #include <sys/types.h>
  878. typedef int pid_t;
  879. typedef int rlim_t;
  880. typedef int mode_t;
  881.  
  882. #elif defined(RISCIX)
  883. #include <sys/time.h>
  884. typedef int rlim_t;
  885. #define NO_USE_SIGACTION
  886. #define USE_LONGJMP
  887. #define NEED_STRCASECMP
  888. #define NEED_STRNCASECMP
  889. #define NEED_STRDUP
  890.  
  891. #elif defined(BEOS)
  892. #undef PLATFORM
  893. #define PLATFORM "BeOS"
  894. #include <stddef.h>
  895.  
  896. #define NO_WRITEV
  897. #define NO_KILLPG
  898. #define NEED_INITGROUPS
  899. #define PF_INET AF_INET
  900. #define S_IEXEC S_IXUSR
  901.  
  902. #elif defined(BONE)
  903. #undef PLATFORM
  904. #define PLATFORM "BeOS BONE"
  905. #define NO_KILLPG
  906. #define NEED_INITGROUPS
  907. #define S_IEXEC S_IXUSR
  908.  
  909. #elif defined(_CX_SX)
  910. #define JMP_BUF sigjmp_buf
  911. #include <sys/types.h>
  912. #include <sys/time.h>
  913.  
  914. #elif defined(WIN32)
  915.  
  916. /* All windows stuff is now in os/win32/os.h */
  917.  
  918. #elif defined(TPF) /* IBM Transaction Processing Facility operating system */
  919.  
  920. #include <tpfeq.h>
  921. #include <tpfio.h>
  922. #include <sysapi.h>
  923. #include <sysgtime.h>
  924. #define PRIMECRAS 0x010000
  925. #define JMP_BUF jmp_buf
  926. #define HAVE_SHMGET
  927. #undef  HAVE_SYS_RESOURCE_H
  928. #define NEED_INITGROUPS
  929. #define NEED_SIGNAL_INTERRUPT
  930. #include <strings.h>
  931. #ifndef __strings_h
  932. #define NEED_STRCASECMP
  933. #define NEED_STRNCASECMP
  934. #endif
  935. #define NEED_STRDUP
  936. #define NO_DBM_REWRITEMAP
  937. #define NO_GETTIMEOFDAY
  938. #define NO_LINGCLOSE
  939. #define NO_MMAP
  940. #define NO_OTHER_CHILD
  941. #define NO_PIPED_LOGS
  942. #define NO_RELIABLE_PIPED_LOGS
  943. #define NO_SETSID
  944. #define NO_SLACK
  945. #define NO_TIMES
  946. #define NO_USE_SIGACTION
  947. #define USE_LONGJMP
  948. #define USE_SHMGET_SCOREBOARD
  949. /*#define USE_TPF_SCOREBOARD*/
  950. #define USE_TPF_ACCEPT
  951. #define USE_TPF_CORE_SERIALIZED_ACCEPT
  952. #define USE_TPF_SELECT
  953. #define S_IREAD S_IRUSR
  954. #define S_IWRITE S_IWUSR
  955. #define S_IEXEC S_IXUSR
  956. #define crypt(buf,salt) ((char *)buf)
  957. #undef  offsetof
  958. #define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field))
  959.  
  960. #elif defined(__TANDEM)
  961. #define NO_WRITEV
  962. #define NO_KILLPG
  963. #define NEED_INITGROUPS
  964. #define NO_SLACK
  965.  
  966. #elif defined(OS390)                /* IBM OS/390 Operating System      */
  967. #define HAVE_MMAP
  968. #define HAVE_SHMGET
  969. #define USE_SHMGET_SCOREBOARD
  970. #define USE_MMAP_FILES
  971. #define NEED_UNION_SEMUN
  972. #define USE_SYSVSEM_SERIALIZED_ACCEPT
  973. #define _POSIX_SOURCE
  974. #include <signal.h>
  975. #ifdef SIGDUMP  /* SIGDUMP is not defined by OS/390 v1r2 */
  976. #define NSIG SIGDUMP+1
  977. #else
  978. #define NSIG 40
  979. #endif
  980. #define JMP_BUF sigjmp_buf
  981. #define _XOPEN_SOURCE_EXTENDED 1
  982. #define _OPEN_MSGQ_EXT
  983. #define _XOPEN_SOURCE
  984. #define SHM_R S_IRUSR
  985. #define SHM_W S_IWUSR
  986. #include <sys/time.h>
  987. #include <sys/types.h>
  988. #include <sys/msg.h>
  989. #include <sys/socket.h>
  990. #define NET_SIZE_T size_t
  991. #define NEED_HASHBANG_EMUL
  992.  
  993. #elif defined(CYGWIN)               /* Cygwin 1.x POSIX layer for Win32 */
  994. #define JMP_BUF jmp_buf
  995. #define NO_KILLPG
  996. #define USE_LONGJMP
  997.  
  998. #else
  999. /* Unknown system - Edit these to match */
  1000. #ifdef BSD
  1001. #define HAVE_GMTOFF 1
  1002. #else
  1003. #undef HAVE_GMTOFF
  1004. #endif
  1005. /* NO_KILLPG is set on systems that don't have killpg */
  1006. #undef NO_KILLPG
  1007. /* NO_SETSID is set on systems that don't have setsid */
  1008. #undef NO_SETSID
  1009. /* NEED_STRDUP is set on stupid systems that don't have strdup. */
  1010. #undef NEED_STRDUP
  1011. #endif
  1012.  
  1013. #ifdef HAVE_SYS_PARAM_H
  1014. #include <sys/param.h>
  1015. #endif /* HAVE_SYS_PARAM_H */
  1016.  
  1017. /* stuff marked API_EXPORT is part of the API, and intended for use
  1018.  * by modules
  1019.  */
  1020. #ifndef API_EXPORT
  1021. #define API_EXPORT(type)    type
  1022. #endif
  1023.  
  1024. /* Stuff marked API_EXPORT_NONSTD is part of the API, and intended for
  1025.  * use by modules.  The difference between API_EXPORT and
  1026.  * API_EXPORT_NONSTD is that the latter is required for any functions
  1027.  * which use varargs or are used via indirect function call.  This
  1028.  * is to accomodate the two calling conventions in windows dlls.
  1029.  */
  1030. #ifndef API_EXPORT_NONSTD
  1031. #define API_EXPORT_NONSTD(type)    type
  1032. #endif
  1033.  
  1034. #ifndef MODULE_VAR_EXPORT
  1035. #define MODULE_VAR_EXPORT
  1036. #endif
  1037. #ifndef API_VAR_EXPORT
  1038. #define API_VAR_EXPORT
  1039. #endif
  1040.  
  1041. /* modules should not used functions marked CORE_EXPORT
  1042.  * or CORE_EXPORT_NONSTD */
  1043. #ifndef CORE_EXPORT
  1044. #define CORE_EXPORT    API_EXPORT
  1045. #endif
  1046. #ifndef CORE_EXPORT_NONSTD
  1047. #define CORE_EXPORT_NONSTD    API_EXPORT_NONSTD
  1048. #endif
  1049.  
  1050. /* On Darwin, symbols that conflict with loaded dylibs
  1051.  * (eg. System framework) need to be declared as private symbols with
  1052.  * __private_extern__.
  1053.  * For other systems, make that a no-op.
  1054.  */
  1055. #if defined(DARWIN) && defined(__DYNAMIC__)
  1056. #define ap_private_extern __private_extern__
  1057. #else
  1058. #define ap_private_extern
  1059. #endif
  1060.  
  1061. /*
  1062.  * The particular directory style your system supports. If you have dirent.h
  1063.  * in /usr/include (POSIX) or /usr/include/sys (SYSV), #include 
  1064.  * that file and define DIR_TYPE to be dirent. Otherwise, if you have 
  1065.  * /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
  1066.  * file. If you have neither, I'm confused.
  1067.  */
  1068.  
  1069. #ifndef NETWARE
  1070. #include <sys/types.h>
  1071. #endif
  1072. #include <stdarg.h>
  1073.  
  1074. #if !defined(NEXT) && !defined(WIN32)
  1075. #include <dirent.h>
  1076. #define DIR_TYPE dirent
  1077. #elif !defined(WIN32)
  1078. #include <sys/dir.h>
  1079. #define DIR_TYPE direct
  1080. #else
  1081. #define DIR_TYPE dirent
  1082. #endif
  1083.  
  1084. #include <stdio.h>
  1085. #include <stdlib.h>
  1086. #include <string.h>
  1087. #ifdef __TANDEM
  1088. #include <strings.h>
  1089. #endif
  1090. #include "ap_ctype.h"
  1091. #if !defined(MPE) && !defined(WIN32) && !defined(TPF) && !defined(__TANDEM) && !defined(NETWARE)
  1092. #include <sys/file.h>
  1093. #endif
  1094. #if !defined(WIN32) && !defined(NETWARE)
  1095. #include <sys/socket.h>
  1096. #ifdef HAVE_SYS_SELECT_H
  1097. #include <sys/select.h>
  1098. #endif /* HAVE_SYS_SELECT_H */
  1099. #ifndef TPF
  1100. #include <netinet/in.h>
  1101. #endif /* TPF */
  1102. #if defined(OS390) && !defined(NO_ADDRESS)
  1103. #define NO_ADDRESS NO_DATA  /* Not defined properly by OS/390 v1r2 */
  1104. #endif
  1105. #include <netdb.h>
  1106. #include <sys/ioctl.h>
  1107. #if !defined(MPE) && !defined(BEOS) && !defined(TPF)
  1108. #include <arpa/inet.h>        /* for inet_ntoa */
  1109. #endif
  1110. #include <sys/wait.h>
  1111. #include <pwd.h>
  1112. #include <grp.h>
  1113. #include <fcntl.h>
  1114. #ifndef BEOS
  1115. #define closesocket(s) close(s)
  1116. #endif
  1117. #ifndef O_BINARY
  1118. #define O_BINARY (0)
  1119. #endif
  1120. #endif /* ndef WIN32 */
  1121.  
  1122. #include <limits.h>
  1123. #include <time.h>        /* for ctime */
  1124. #ifdef WIN32
  1125. #define strftime(s,max,format,tm)  os_strftime(s,max,format,tm)
  1126. #endif
  1127. #include <signal.h>
  1128. #ifdef NETWARE
  1129. #undef SIGKILL
  1130. #undef SA_NOCLDSTOP
  1131. #undef SIGALRM
  1132. #undef SIGCHILD
  1133. #undef SIGCONT
  1134. #undef SIGHUP
  1135. #undef SIGPIPE
  1136. #undef SIGQUIT
  1137. #undef SIGSTOP
  1138. #undef SIGTSTP
  1139. #undef SIGTTIN
  1140. #undef SIGTTOU
  1141. #undef SIGUSR1
  1142. #undef SIGUSR2
  1143. #undef SIG_BLOCK
  1144. #undef SIG_SETMASK
  1145. #undef SIG_UNBLOCK
  1146. #endif
  1147. #if defined(TPF) && defined(NSIG)
  1148. #undef NSIG
  1149. #endif
  1150. #include <errno.h>
  1151. #if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF) && !defined(NETWARE) && !defined(MPE)
  1152. #include <memory.h>
  1153. #endif
  1154.  
  1155. #ifdef NEED_PROCESS_H
  1156. #include <process.h>
  1157. #endif
  1158.  
  1159. #if defined(WIN32) || defined(USE_HSREGEX)
  1160. #include "hsregex.h"
  1161. #else
  1162. #include <regex.h>
  1163. #endif
  1164.  
  1165. #ifdef HAVE_SYS_RESOURCE_H
  1166. #include <sys/resource.h>
  1167. #ifdef SUNOS4
  1168. int getrlimit(int, struct rlimit *);
  1169. int setrlimit(int, struct rlimit *);
  1170. #endif
  1171. #endif
  1172. #ifdef USE_MMAP_SCOREBOARD
  1173. #if !defined(OS2) && !defined(WIN32)
  1174. /* This file is not needed for OS/2 */
  1175. #include <sys/mman.h>
  1176. #endif
  1177. #endif
  1178. #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
  1179. #define MAP_ANON MAP_ANONYMOUS
  1180. #endif
  1181.  
  1182. #if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
  1183. #undef USE_MMAP_FILES
  1184. #endif
  1185.  
  1186. #if defined(USE_MMAP_SCOREBOARD) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
  1187. #undef USE_MMAP_SCOREBOARD
  1188. #endif
  1189.  
  1190. #if defined(USE_SHMGET_SCOREBOARD) && (defined(NO_SHMGET) || !defined(HAVE_SHMGET))
  1191. #undef USE_SHMGET_SCOREBOARD
  1192. #endif
  1193.  
  1194. #ifndef LOGNAME_MAX
  1195. #define LOGNAME_MAX 25
  1196. #endif
  1197.  
  1198. #ifdef HAVE_UNISTD_H
  1199. #include <unistd.h>
  1200. #endif
  1201.  
  1202. #ifdef ultrix
  1203. #define ULTRIX_BRAIN_DEATH
  1204. #endif
  1205.  
  1206. #ifndef S_ISLNK
  1207. #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
  1208. #endif
  1209.  
  1210. #ifndef INADDR_NONE
  1211. #define INADDR_NONE ((unsigned long) -1)
  1212. #endif
  1213.  
  1214. /*
  1215.  * Replace signal function with sigaction equivalent
  1216.  */
  1217. #ifndef NO_USE_SIGACTION
  1218. typedef void Sigfunc(int);
  1219.  
  1220. #if defined(SIG_IGN) && !defined(SIG_ERR)
  1221. #define SIG_ERR ((Sigfunc *)-1)
  1222. #endif
  1223.  
  1224. /*
  1225.  * For some strange reason, QNX defines signal to signal. Eliminate it.
  1226.  */
  1227. #ifdef signal
  1228. #undef signal
  1229. #endif
  1230. #define signal(s,f)    ap_signal(s,f)
  1231. Sigfunc *signal(int signo, Sigfunc * func);
  1232. #endif
  1233.  
  1234. #include <setjmp.h>
  1235.  
  1236. #if defined(USE_LONGJMP)
  1237. #define ap_longjmp(x, y)        longjmp((x), (y))
  1238. #define ap_setjmp(x)            setjmp(x)
  1239. #ifndef JMP_BUF
  1240. #define JMP_BUF jmp_buf
  1241. #endif
  1242. #else
  1243. #define ap_longjmp(x, y)        siglongjmp((x), (y))
  1244. #define ap_setjmp(x)            sigsetjmp((x), 1)
  1245. #ifndef JMP_BUF
  1246. #define JMP_BUF sigjmp_buf
  1247. #endif
  1248. #endif
  1249.  
  1250. /* Majority of os's want to verify FD_SETSIZE */
  1251. #if !defined(WIN32) && !defined(TPF) && !defined(NETWARE)
  1252. #define CHECK_FD_SETSIZE
  1253. #endif
  1254.  
  1255. #ifdef USE_TPF_SELECT
  1256. #define ap_select(_a, _b, _c, _d, _e)    \
  1257.     tpf_select(_a, _b, _c, _d, _e)
  1258. #elif defined(SELECT_NEEDS_CAST)
  1259. #define ap_select(_a, _b, _c, _d, _e)   \
  1260.     select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e))
  1261. #else
  1262. #define ap_select(_a, _b, _c, _d, _e)   \
  1263.     select(_a, _b, _c, _d, _e)
  1264. #endif
  1265.  
  1266. #ifdef USE_TPF_ACCEPT
  1267. #define ap_accept(_fd, _sa, _ln)    tpf_accept(_fd, _sa, _ln)
  1268. #else
  1269. #define ap_accept(_fd, _sa, _ln)    accept(_fd, _sa, _ln)
  1270. #endif
  1271.  
  1272. #ifdef NEED_SIGNAL_INTERRUPT
  1273. #define ap_check_signals()    tpf_process_signals()
  1274. #else
  1275. #define ap_check_signals()
  1276. #endif
  1277.  
  1278. #ifdef ULTRIX_BRAIN_DEATH
  1279. #define ap_fdopen(d,m) fdopen((d), (char *)(m))
  1280. #else
  1281. #define ap_fdopen(d,m) fdopen((d), (m))
  1282. #endif
  1283.  
  1284. #ifndef ap_inet_addr
  1285. #define ap_inet_addr inet_addr
  1286. #endif
  1287.  
  1288. #ifdef NO_OTHER_CHILD
  1289. #define NO_RELIABLE_PIPED_LOGS
  1290. #endif
  1291.  
  1292. /* When the underlying OS doesn't support exec() of scripts which start
  1293.  * with a HASHBANG (#!) followed by interpreter name and args, define this.
  1294.  */
  1295. #ifdef NEED_HASHBANG_EMUL
  1296. extern int ap_execle(const char *filename, const char *arg,...);
  1297. extern int ap_execve(const char *filename, char * const argv[],
  1298.                      char * const envp[]);
  1299. /* ap_execle() is a wrapper function around ap_execve(). */
  1300. #define execle  ap_execle
  1301. #define execve(path,argv,envp)  ap_execve(path,argv,envp)
  1302. #endif
  1303.  
  1304. /* Finding offsets of elements within structures.
  1305.  * Taken from the X code... they've sweated portability of this stuff
  1306.  * so we don't have to.  Sigh...
  1307.  */
  1308.  
  1309. #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
  1310. #ifdef __STDC__
  1311. #define XtOffset(p_type,field) _Offsetof(p_type,field)
  1312. #else
  1313. #ifdef CRAY2
  1314. #define XtOffset(p_type,field) \
  1315.     (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
  1316.  
  1317. #else /* !CRAY2 */
  1318.  
  1319. #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
  1320.  
  1321. #endif /* !CRAY2 */
  1322. #endif /* __STDC__ */
  1323. #else /* ! (CRAY || __arm) */
  1324.  
  1325. #define XtOffset(p_type,field) \
  1326.     ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
  1327.  
  1328. #endif /* !CRAY */
  1329.  
  1330. #ifdef offsetof
  1331. #define XtOffsetOf(s_type,field) offsetof(s_type,field)
  1332. #else
  1333. #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
  1334. #endif
  1335.  
  1336. /*
  1337.  * NET_SIZE_T exists because of shortsightedness on the POSIX committee.  BSD
  1338.  * systems used "int *" as the parameter to accept(), getsockname(),
  1339.  * getpeername() et al.  Consequently many unixes took an int * for that
  1340.  * parameter.  The POSIX committee decided that "int" was just too generic and
  1341.  * had to be replaced with size_t almost everywhere.  There's no problem with
  1342.  * that when you're passing by value.  But when you're passing by reference
  1343.  * this creates a gross source incompatibility with existing programs.  On
  1344.  * 32-bit architectures it creates only a warning.  On 64-bit architectures it
  1345.  * creates broken code -- because "int *" is a pointer to a 64-bit quantity and
  1346.  * "size_t *" is frequently a pointer to a 32-bit quantity.
  1347.  *
  1348.  * Some Unixes adopted "size_t *" for the sake of POSIX compliance.  Others
  1349.  * ignored it because it was such a broken interface.  Chaos ensued.  POSIX
  1350.  * finally woke up and decided that it was wrong and created a new type
  1351.  * socklen_t.  The only useful value for socklen_t is int, and that's how
  1352.  * everyone who has a clue implements it.  It is almost always the case that
  1353.  * NET_SIZE_T should be defined to be an int, unless the system being compiled
  1354.  * for was created in the window of POSIX madness.
  1355.  */
  1356. #ifndef NET_SIZE_T
  1357. #define NET_SIZE_T int
  1358. #endif
  1359.  
  1360. /* Linux defines __WCOREDUMP, but doesn't define WCOREDUMP unless __USE_BSD
  1361.  * is in use... we'd prefer to just use WCOREDUMP everywhere.
  1362.  */
  1363. #if defined(__WCOREDUMP) && !defined(WCOREDUMP)
  1364. #define WCOREDUMP __WCOREDUMP
  1365. #endif
  1366.  
  1367. #ifdef SUNOS_LIB_PROTOTYPES
  1368. /* Prototypes needed to get a clean compile with gcc -Wall.
  1369.  * Believe it or not, these do have to be declared, at least on SunOS,
  1370.  * because they aren't mentioned in the relevant system headers.
  1371.  * Sun Quality Software.  Gotta love it.  This section is not 
  1372.  * currently (13Nov97) used.
  1373.  */
  1374.  
  1375. int getopt(int, char **, char *);
  1376.  
  1377. int strcasecmp(const char *, const char *);
  1378. int strncasecmp(const char *, const char *, int);
  1379. int toupper(int);
  1380. int tolower(int);
  1381.  
  1382. int printf(char *,...);
  1383. int fprintf(FILE *, char *,...);
  1384. int fputs(char *, FILE *);
  1385. int fread(char *, int, int, FILE *);
  1386. int fwrite(char *, int, int, FILE *);
  1387. int fgetc(FILE *);
  1388. char *fgets(char *s, int, FILE*);
  1389. int fflush(FILE *);
  1390. int fclose(FILE *);
  1391. int ungetc(int, FILE *);
  1392. int _filbuf(FILE *);    /* !!! */
  1393. int _flsbuf(unsigned char, FILE *);    /* !!! */
  1394. int sscanf(char *, char *,...);
  1395. void setbuf(FILE *, char *);
  1396. void perror(char *);
  1397.  
  1398. time_t time(time_t *);
  1399. int strftime(char *, int, const char *, struct tm *);
  1400.  
  1401. int initgroups(char *, int);
  1402. int wait3(int *, int, void *);    /* Close enough for us... */
  1403. int lstat(const char *, struct stat *);
  1404. int stat(const char *, struct stat *);
  1405. int flock(int, int);
  1406. #ifndef NO_KILLPG
  1407. int killpg(int, int);
  1408. #endif
  1409. int socket(int, int, int);
  1410. int setsockopt(int, int, int, const char *, int);
  1411. int listen(int, int);
  1412. int bind(int, struct sockaddr *, int);
  1413. int connect(int, struct sockaddr *, int);
  1414. int accept(int, struct sockaddr *, int *);
  1415. int shutdown(int, int);
  1416.  
  1417. int getsockname(int s, struct sockaddr *name, int *namelen);
  1418. int getpeername(int s, struct sockaddr *name, int *namelen);
  1419. int gethostname(char *name, int namelen);
  1420. void syslog(int, char *,...);
  1421. char *mktemp(char *);
  1422.  
  1423. int vfprintf(FILE *, const char *, va_list);
  1424.  
  1425. #endif /* SUNOS_LIB_PROTOTYPES */
  1426.  
  1427. /* The assumption is that when the functions are missing,
  1428.  * then there's no matching prototype available either.
  1429.  * Declare what is needed exactly as the replacement routines implement it.
  1430.  */
  1431. #ifdef NEED_STRDUP
  1432. extern char *strdup (const char *str);
  1433. #endif
  1434. #ifdef NEED_STRCASECMP
  1435. extern int strcasecmp (const char *a, const char *b);
  1436. #endif
  1437. #ifdef NEED_STRNCASECMP
  1438. extern int strncasecmp (const char *a, const char *b, int n);
  1439. #endif
  1440. #ifdef NEED_INITGROUPS
  1441. extern int initgroups(const char *name, gid_t basegid);
  1442. #endif
  1443. #ifdef NEED_WAITPID
  1444. extern int waitpid(pid_t pid, int *statusp, int options);
  1445. #endif
  1446. #ifdef NEED_STRERROR
  1447. extern char *strerror (int err);
  1448. #endif
  1449. #ifdef NEED_DIFFTIME
  1450. extern double difftime(time_t time1, time_t time0);
  1451. #endif
  1452.  
  1453. #ifndef ap_wait_t
  1454. #define ap_wait_t int
  1455. #endif
  1456.  
  1457. #ifdef __cplusplus
  1458. }
  1459. #endif
  1460.  
  1461. #endif /* !AP_CONFIG_H */
  1462.